]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
osdWindow: Remove LevelBar and use BarLevel directly
authorverdre <verdre@v0yd.nl>
Sat, 2 Feb 2019 16:58:47 +0000 (17:58 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 28 Jul 2019 15:27:53 +0000 (17:27 +0200)
LevelBar is not really used, all the checks are implemented inside
BarLevel as well and the accessible name is wrong because the osdWindow
doesn't only show the volume, but also the brightness and other things.

The workaround for updating the bars width is also no longer needed now
that we have BarLevel.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385

js/ui/osdWindow.js

index 9262f28d4abf9271638a358c75794b682bef09a0..f6337f16749740fb57e2b3a4461757b80c9a4b81 100644 (file)
@@ -13,39 +13,6 @@ var HIDE_TIMEOUT = 1500;
 var FADE_TIME = 0.1;
 var LEVEL_ANIMATION_TIME = 0.1;
 
-var LevelBar = class extends BarLevel.BarLevel {
-    constructor() {
-        super(0, { styleClass: 'level' });
-
-        this._level = 0;
-        this._maxLevel = 1;
-
-        this.actor.accessible_name = _("Volume");
-
-        this.actor.connect('notify::width', () => this.level = this.level);
-    }
-
-    get level() {
-        return this._level;
-    }
-
-    set level(value) {
-        this._level = Math.max(0, Math.min(value, this._maxLevel));
-
-        this.value = this._level;
-    }
-
-    get maxLevel() {
-        return this._maxLevel;
-    }
-
-    set maxLevel(value) {
-        this._maxLevel = Math.max(1, value);
-
-        this.maximum_level = this._maxLevel;
-    }
-};
-
 var OsdWindowConstraint = GObject.registerClass(
 class OsdWindowConstraint extends Clutter.Constraint {
     _init(props) {
@@ -99,7 +66,7 @@ var OsdWindow = class {
         this._label = new St.Label();
         this._box.add(this._label);
 
-        this._level = new LevelBar();
+        this._level = new BarLevel.BarLevel(0, { styleClass: 'level' });
         this._box.add(this._level.actor);
 
         this._hideTimeoutId = 0;
@@ -139,21 +106,21 @@ var OsdWindow = class {
             this._label.text = label;
     }
 
-    setLevel(level) {
-        this._level.actor.visible = (level != undefined);
-        if (level != undefined) {
+    setLevel(value) {
+        this._level.actor.visible = (value != undefined);
+        if (value != undefined) {
             if (this.actor.visible)
                 Tweener.addTween(this._level,
-                                 { level: level,
+                                 { value: value,
                                    time: LEVEL_ANIMATION_TIME,
                                    transition: 'easeOutQuad' });
             else
-                this._level.level = level;
+                this._level.value = value;
         }
     }
 
     setMaxLevel(maxLevel = 1) {
-        this._level.maxLevel = maxLevel;
+        this._level.maximum_value = maxLevel;
     }
 
     show() {